package facade.bean;

import java.util.List;

import javax.inject.Inject;

import model.Club;

import repository.ClubSO;
import service.ClubService;

import common.Mapper;

import facade.ClubFacade;
import facade.dto.ClubDTO;
import facade.dto.ClubSoDTO;

/**
 * Implementation of {@link ClubFacade}
 *
 */
public class ClubFacadeBean implements ClubFacade {

	@Inject
	private ClubService service;
	
	@Inject
	private Mapper mapper;
	
	public ClubDTO get(Long id) {
		return mapper.map(service.get(id), ClubDTO.class);
	}

	public List<ClubDTO> getAll() {
		return mapper.mapList(service.getAll(), ClubDTO.class);
	}

	@Override
	public List<ClubDTO> completeClub(ClubSoDTO criteria) {
		return mapper.mapList(service.completeClub(mapper.map(criteria,ClubSO.class)), ClubDTO.class);
	}

	@Override
	public ClubDTO createClub(ClubDTO club) {
		return mapper.map(service.create(mapper.map(club,Club.class)), ClubDTO.class);
	}

	@Override
	public ClubDTO modifyClub(ClubDTO club) {
		return mapper.map(service.modify(mapper.map(club,Club.class)), ClubDTO.class);
	}

	@Override
	public void removeClub(Long id) {
		service.delete(id);
	}

}
